#include "../../include/jni/com_lemon_jvm_jdk_sun_misc_Unsafe.h"
#include "../../include/memory/memory_chunk.h"


extern MemoryChunk* g_newGeneration;

/*
 * Class:     com_lemon_jvm_jdk_sun_misc_Unsafe
 * Method:    allocateMemory
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_com_lemon_jvm_jdk_sun_misc_Unsafe_allocateMemory
        (JNIEnv *env, jclass jclazz, jlong size){
    INFO_PRINT("%d\n", size);
    MemoryCell* cell = g_newGeneration->malloc(size);
    return reinterpret_cast<jlong>(cell->ptr());
}

